<?php
/**
 * Created by PhpStorm.
 * User: Mr wang
 * Date: 2019/12/14
 * Time: 上午11:34
 */

namespace App\HttpService\Api\V1;

use App\Model\UsersModel;
use App\Validate\UserValidate;

class UserService
{
    protected $validate;

    public function __construct()
    {
        $this->validate = new UserValidate();
    }

    public function login()
    {
        return returnRight(['name' => '王宁']);
    }

    public function testValidate()
    {
        $data = [
            'name' => ''
        ];
        $result = $this->validate->secnceName('add')->check($data);
        if ($result !== true) {
            return returnError($result);
        }
    }

    public function addUsers($params)
    {
        $model = UsersModel::create($params);
        $res = $model->save();
        return returnRight();
    }
}
